<template>
  <div class="view-content-box">
    <div class="type-list">
      <div :class="type == 0 && 'active'" @click="type = 0">支出</div>
      <div :class="type == 1 && 'active'" @click="type = 1">收入</div>
    </div>

    <LoadList
      :loadingData="postAgentUserWalletLogPage"
      :queryParams="{ type: 0 }"
      class="view-content"
      v-if="type == 0"
    >
      <template #list="{ list }">
        <div class="device-list">
          <div v-for="(item, index) in list" :key="item.id || index">
            <div class="d-flex j-sb">
              <div class="type">提现支出</div>
              <div class="num">-{{ item.amountYuan }}</div>
            </div>
            <div class="d-flex j-sb">
              <div class="time">{{ item.createTime }}</div>
              <div :class="['status-text', 'success', 'fail']">提现成功</div>
            </div>
          </div>
        </div>
      </template>
    </LoadList>
    <LoadList
      :loadingData="postAgentUserWalletLogPage"
      :queryParams="{ type: 1 }"
      class="view-content"
      v-else
    >
      <template #list="{ list }">
        <div class="wallet-list">
          <div
            v-for="(item, index) in list"
            :key="item.id || index"
            class="wallet-item d-flex j-sb a-center"
          >
            <div class="">
              <div class="name">门店名称：{{ item.shopName }}</div>
              <!-- <div class="code">设备编码：{{ item.deviceNo }}</div> -->
              <div class="time">{{ item.createTime }}</div>
            </div>
            <div class="num">+{{ item.amountYuan }}</div>
          </div>
        </div>
      </template>
    </LoadList>
  </div>
</template>

<script setup>
import {
  postMpDeviceStatistics,
  postAgentUserWalletLogPage,
} from "@/api/index";
import { onMounted } from "vue";
const router = useRouter();
const type = ref(0);
const detail = ref({
  deviceNum: "112",
  errorNum: "112",
});
// const list = ref([]);
const getStatistics = () => {
  postMpDeviceStatistics().then((res) => {
    console.log(res);
    detail.value = res.data;
  });
};

onMounted(() => {
  // getStatistics();
  // getList();
});
</script>

<style lang="less" scoped>
.type-list {
  display: flex;
  margin: 20px 144px;
  justify-content: center;
  div {
    width: 134px;
    height: 64px;
    background: #ffffff;
    border-radius: 32px;
    font-size: 30px;
    color: #151515;
    font-weight: 600;
    text-align: center;
    line-height: 64px;
    &:first-child {
      margin-right: 100px;
    }
    &.active {
      background: #fedc00;
    }
  }
}
.add-btn {
  width: 100%;
  height: 70px;
  line-height: 70px;
  text-align: center;
  background: #fff;
  border-radius: 30px;
  color: #000;
  font-size: 32px;
  margin: 30px 0;
}
.device-list {
  display: flex;
  // gap: 20px;
  flex-wrap: wrap;
  > div {
    width: 100%;
    height: 140px;
    color: #969696;
    font-size: 26px;
    background: #fff;
    // border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    padding: 24px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    img {
      width: 200px;
      height: 120px;
      background: #ccc;
      margin-bottom: 20px;
    }
    .name {
      margin-bottom: 8px;
    }
    .code {
      margin-bottom: 10px;
      font-size: 30px;
    }
  }
  .type {
    font-size: 32px;
    color: #333333;
  }
  .num {
    font-size: 36px;
    color: #151515;
    font-weight: 600;
  }
  .time {
    font-size: 26px;
    color: #999999;
  }
  .status-text {
    font-size: 28px;
    &.success {
      color: #00ea34;
    }
    &.fail {
      color: #ff4e00;
    }
  }
}

.wallet-list {
  .wallet-item {
    padding: 24px 36px;
    font-size: 26px;
    color: #999999;
    background: #fff;
    margin-bottom: 20px;
    line-height: 36px;
    .name {
      font-size: 32px;
      color: #333333;
      margin-bottom: 14px;
      line-height: 44px;
    }
    .code {
      margin-bottom: 6px;
    }
    .num {
      font-weight: 600;
      font-size: 36px;
      color: #151515;
    }
  }
}

.use-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  .all-item {
    background: #fffbe0;
    position: relative;
    height: 35px;
    text-align: center;
    .use-item {
      position: absolute;
      height: 100%;
      top: 0;
      left: 0;
      z-index: 1;
      &.radius {
        border-radius: 0 12px 12px 0;
      }
    }
    &:nth-child(1) {
      .use-item {
        background: #fedc00;
      }
    }
    &:nth-child(2) {
      .use-item {
        background: #f93c31;
      }
    }
    &:nth-child(3) {
      .use-item {
        background: #8dc936;
      }
    }
    span {
      position: relative;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
      font-size: 24px;
    }
  }
}
</style>
